<?
include_once 'inc/db.php';
include_once 'inc/core.php';
echo getDateTime()."<br />";

$regex = "'<td colspan=\"2\" rowspan=\"3\" align=\"center\"><font face=\"Microsoft Sans Serif\" color=\"#FF0000\" size=\"3\".*>(.*)<br>'Uis";

// php ile doviz kuru
// e : bugrakaan@gmail.com

// orj: http://adobeturk.com/forum/php-ile-doviz-kuru-scripti-vt5693.html

/**
 * references:
 * 'Uis -> http://www.saltokunur.net/regex-teki-uis-nedir-t29994.html?s=688d368285969ca25dc2780131d5b674&amp;
 * preg_match -> http://www.orhandogan.us/2007/11/17/preg_match-kullanimi/
 *
 * regex: <td colspan="2" rowspan="3" align="center"><font face="Microsoft Sans Serif" color="#FF0000" size="3">1,90<br>
 *
 */

/*
 $currency = array(
 "ANHYT",
 "ARCLK",
 "BIMAS",
 "ISCTR",
 "KCHOL"
 );

 foreach($currency as $code){
 $content = file_get_contents("http://www.foreks.com/hisse/pages/index.jsp?code=".$code."EN");
 //echo $content;
 preg_match($regex,$content,$crst);
 echo "<img src=http://graph.foreks.com/gifs/foreks/tic/".$code."E.gif width=114px height=80px />";
 echo "$code : ".$crst[1]."<br />";
 }
 */

$sorgu = mysql_query("SELECT * FROM ise_tahtalar WHERE inceleme = 'on' ORDER BY `tahta`");
//$sorgu = mysql_query("SELECT * FROM ise_tahtalar");
while($row = mysql_fetch_array($sorgu))
{
	$code = $row['tahta'];
	$content = file_get_contents("http://www.foreks.com/hisse/pages/index.jsp?code=".$code."EN");
	//echo $content;
	preg_match($regex,$content,$crst);
	echo "<img src=http://graph.foreks.com/gifs/foreks/tic/".$code."E.gif width=114px height=80px />";
	echo "$code : ".$crst[1]."<br />";
}

echo getDateTime()."<br />";
?>
&copy; foreks
